package com.cos.shop.service.impl;

import com.cos.shop.common.ResponseResult;
import com.cos.shop.dao.TypeDao;
import com.cos.shop.dao.impl.TypeDaoImpl;
import com.cos.shop.entity.Type;
import com.cos.shop.service.TypeServices;

import java.sql.SQLException;
import java.util.List;

/**
 * Copyright (C),2021-2022,亚瑟王
 * FileName: TypeServicesImpl
 * Author: saber
 * Date:2022/9/17 11:06
 */
public class TypeServicesImpl implements TypeServices {
    private TypeDao td = new TypeDaoImpl();

    @Override
    public ResponseResult getAll() {
        try {
            List<Type> typeList = td.getAll();

            if (typeList!=null) {
                return ResponseResult.createSuccess(typeList);
            }
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return ResponseResult.createFail("暂时没有该商品类型");
    }

}
